<template>
	<view class="fill_wp">
		<view class="wp">
			<view class="shu_title">
				<view class="span"></view>
				<text>商户信息</text>
			</view>
		</view>
		
		<view class="fill_con bg_bai">			
			<view class="item">
				<view class="span">商户名</view>
				<input class="uni_input" type="text" :value="info.merchant.name" placeholder="请输入" />
			</view>
			<view class="item">
				<view class="span">商户号</view>
				<input class="uni_input" type="text" :value="info.merchant.merchantno" placeholder="请输入" />
			</view>
			<navigator url="/pages/shop/code" hover-class="none">
			<view class="item">
				<view class="span">商户二维码</view>
				<view class="pic_text">
					<image src="../../static/images/c_i7.png" mode="widthFix"></image>
				</view>
			</view>
			</navigator>
		</view>
		<view class="wp">
			<view class="shu_title mt30">
				<view class="span"></view>
				<text>基本信息</text>
			</view>
		</view>

		<view class="fill_con bg_bai">			
			<view class="item">
				<view class="span">姓名</view>
				<input class="uni_input" type="text" v-model="nickname" placeholder="请输入" />
			</view>
			<view class="item">
				<view class="span">手机号</view>
				<input class="uni_input" type="text" v-model="phone" placeholder="请输入" />
			</view>
			<!-- <view class="item">
				<view class="span">性别</view>
				<picker @change="bindPickerChange" :value="index" :range="array">
					<view class="mass">{{index==-1?'请选择':array[index]}}</view>
				</picker>
			</view> -->
			<view class="item">
				<view class="span">身份证号</view>
				<input class="uni_input" type="idcard" v-model="idcard" placeholder="请输入" />
			</view>
		</view>

		
		<view class="h"></view>
		<!-- <view class="food_btn">
			<view class="food_btn_con">
				<text class="btn btn_two">保存</text>
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nickname:'',
				phone:'',
				idcard:'',
				array: ['男', '女'],
				index: -1,	
				info:{merchant:{}},
			}
		},
		onLoad() {
			let that = this;
			
			if (that.common.GetStorage('byh5token')) {
				that.logintype = that.common.GetStorage('byh5type');				
				that.GetUserMass();
				
			} else {
				uni.reLaunch({
					url: '/pages/login/login',
				})
			}
			

		},
		methods: {
			
			GetUserMass:function(){
				let that = this;
				uni.showLoading({
					title: '加载中...',
					mask: true
				});
				that.common.http('GET', 'user', '', function(res) {
					uni.hideLoading();
					console.log(res.data)
					that.nickname = res.data.nickname;
					that.phone = res.data.phone;					
					that.index = res.data.gender =='男'?0:res.data.gender =='女'?1:-1;
					that.idcard = res.data.idcard;
					that.info = res.data;
				});
			},
			
			bindPickerChange: function(e) {
				console.log('picker发送选择改变，携带值为', e.detail.value)
				this.index = e.detail.value
			},
		}
	}
</script>

<style scoped>
	.fill_wp {
		padding-top: 30rpx;
	}

	.mt30 {
		margin-top: 30rpx;
	}
</style>